package com.sc.nft.entity.vo.mall;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.sc.nft.dto.MallOrderRefundDTO;
import com.sc.nft.entity.dto.ApiOrderDirectDTO;
import com.sc.nft.enums.MallOrderRefundStatusEnum;
import com.sc.nft.enums.MallOrderStatusEnum;
import com.sc.nft.enums.task.ActivityTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
public class MallOrderDetailsVO {

    @ApiModelProperty("订单id")
    private Long id;

    @ApiModelProperty("订单状态: TIMEOUT_CANCEL:超时取消 WAIT_PAY:待付款 WAIT_RECEIPT:待发货 TO_BE_RECEIPT:待收货 RECEIPT:已收货 FINISH:已完成")
    private MallOrderStatusEnum status;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty("过期时间")
    private Date expiredTime;

    @ApiModelProperty("过期时间戳")
    private Long expiredTimeStamp =0L;

    @ApiModelProperty("当前时间戳")
    private Long nowTimeStamp =0L;

    @ApiModelProperty("品牌名称")
    private String daoName;

    @ApiModelProperty("品牌id")
    private String daoId;

    @ApiModelProperty("订单类型 : SALES:销售订单  EXCHANGE:兑换订单")
    private ActivityTypeEnum activityType;

    @ApiModelProperty("客服外联")
    private String customerServiceUrl;

    @ApiModelProperty("实付金额")
    private String realPrice;

    /**
     * 优惠券金额
     */
    @ApiModelProperty("优惠券金额")
    private BigDecimal couponAmount;

    @ApiModelProperty("订单编号")
    private String orderNo;

    @ApiModelProperty("收货信息")
    private String userAddr;

    @ApiModelProperty("物流单号")
    private String deliveryNo;

    @ApiModelProperty("商品列表")
    private List<MallOrderProductDetailsVO> productList;

    @ApiModelProperty("订单状态时间")
    private List<MallOrderStatusVO> statusList;

    @ApiModelProperty("是否可以申请售后")
    private Boolean isRefund;

    /**
     * 是否为虚拟商品订单
     */
    @ApiModelProperty("是否为虚拟商品订单")
    private Boolean isVirtual;

    @ApiModelProperty("直充订单")
    private ApiOrderDirectDTO apiOrderDirectDTO;

    @ApiModelProperty("兑换列表")
    private List<MallOrderDetailsExchangeVO> exchangeList;

    /**
     * 订单售后列表
     */
    @ApiModelProperty("订单售后列表")
    private List<MallOrderRefundDTO> mallOrderRefundDTOList;

    @ApiModelProperty("售后状态: NOT_APPLY:申请中 APPLYING:申请中 REFUSE_REFUND:拒绝退款 REFUNDING:退款中 REFUND_SUCCES:已退款  CANCEL:取消退款")
    private MallOrderRefundStatusEnum refundStatus;
    /**
     * 余额支付金额
     */
    @ApiModelProperty("余额支付金额")
    private String payWalletPrice;
    /**
     * 红包支付金额
     */
    @ApiModelProperty("红包支付金额")
    private String payBalancePrice;
    /**
     * 心愿礼金支付
     */
    @ApiModelProperty("心愿礼金支付")
    private String wishBalancePrice;

    /**
     * 是否可以修改地址
     */
    @ApiModelProperty("是否可以修改地址")
    private Boolean canEditAddr = Boolean.FALSE;

    public void setPayPrice(BigDecimal realPrice) {
        this.realPrice = realPrice.setScale(2,BigDecimal.ROUND_DOWN).toPlainString();
    }

    public void setPayWalletPrice(BigDecimal payWalletPrice) {
        this.payWalletPrice = payWalletPrice.setScale(2,BigDecimal.ROUND_DOWN).toPlainString();;
    }

    public void setPayBalancePrice(BigDecimal payBalancePrice) {
        this.payBalancePrice = payBalancePrice.setScale(2,BigDecimal.ROUND_DOWN).toPlainString();;
    }

    public void setWishBalancePrice(BigDecimal wishBalancePrice) {
        this.wishBalancePrice = wishBalancePrice.setScale(2,BigDecimal.ROUND_DOWN).toPlainString();;
    }
}
